<template>
	<view class="app-container content">
		<view class="activity-list">
			<view class="activity-item" v-for="activity in list">
				<view class="activity-wrap">
					<view class="title">{{activity.title}}</view>
					<view class="text">{{activity.textContent}}</view>
				</view>
				<view class="material-list">
					<view class="material-wrap" v-for="material in activity.materialList">
						<image v-if="material.fileType == '图片'" class="image" :src="material.fileUrl" mode="widthFix"></image>
						<video v-else class="image" :src="material.fileUrl"></video>
						<view class="title">{{material.name}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="no-data" v-if="list.length == 0">
			<uni-icons custom-prefix="iconfont" type="icon-no-data" size="32" color="#999999"></uni-icons>
			<text class="text">暂无数据</text>
		</view>
	</view>
</template>

<script>
	import { ApiActivity } from "@/api/information/index.js";
	export default {
		data() {
			return {
				queryParams: {
					manageDeptId: null,
					title: null,
					releaseStatus: '已发布',
					status: '1',
					byDesc: 'id',
					likeColumns: 'title',
					pageNum: 1,
					pageSize: 5
				},
				list: [],
				total: 0,
				pages: 0
			}
		},
		created() {
			this.queryParams.manageDeptId = this.$store.getUser().manageDeptId;
			this.getList();
		},
		onLoad() {
		
		},
		onReachBottom() {
			this.loadMore();
		},
		methods: {
			
			getList(){
				ApiActivity.list(this.queryParams).then(res=>{
					this.list.push(...res.data.records);
					this.total = res.data.total;
					this.pages = res.data.pages;
				})
			},
			
			loadMore(){
				if(this.queryParams.pageNum >= this.pages)return;
				this.queryParams.pageNum = this.queryParams.pageNum+1;
				this.getList();
			},
		}
	}
</script>

<style>
	.content {
		background-color: #F7F9FF;
	}
	.activity-list{
		
	}
	.activity-wrap{
		background-color: white;
		margin-bottom: 30upx;
	}
	.activity-wrap .title{
		padding: 30upx;
		font-size: 16px;
		font-weight: bold;
		background-color: white;
	}
	.activity-wrap .text{
		padding: 20upx 30upx;
		padding-top: 0;
		font-size: 14px;
		color: #666666;
	}
	.material-list{
		
	}
	.material-wrap{
		
	}
	.material-wrap .title{
		padding: 20upx 30upx;
		margin-bottom: 10upx;
		font-size: 14px;
		font-weight: bold;
		background-color: white;
	}
	.material-wrap .image{
		width: 690upx;
		margin: 0upx 30upx;
	}
	
</style>
